package com.tech.platform.cms.admin.controller;

import com.tech.platform.cms.admin.dao.pojo.Tenant;
import com.tech.platform.cms.admin.service.TenantService;
import com.tech.platform.cms.common.model.CommonResult;
import com.tech.platform.cms.common.model.PageResult;
import com.tech.platform.cms.logger.annotation.ApiLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author shengqiang.wu
 * @date 2020/3/24/024 17:39
 * @desc
 */
@RestController
@RequestMapping(value = "/admin/tenant")
public class TenantController {

    @Autowired
    private TenantService tenantService;

    @ApiLog(apiModule = "加盟商管理",apiName = "添加加盟商")
    @RequestMapping(value = "/add",method = RequestMethod.PUT)
    public CommonResult<String> add(Tenant tenant){
        return tenantService.addTenant(tenant);
    }

    @ApiLog(apiModule = "加盟商管理",apiName = "分页查询")
    @RequestMapping(value = "/page",method = RequestMethod.GET)
    public PageResult<List<Tenant>> page(int current,int size,String keyword) throws Exception{
        return tenantService.page(current,size,keyword);
    }
}
